package com.kevin.learn.适配器模式;

import com.alibaba.fastjson.JSON;
import com.kevin.learn.test.LxSelectBean;

public class AudioPlayer implements MediaPlayer {
    MediaAdapter mediaAdapter;

    @Override
    public void play(String audioType, String fileName) {

        //播放 mp3 音乐文件的内置支持
        if (audioType.equalsIgnoreCase("mp3")) {
            System.out.println("Playing mp3 file. Name: " + fileName);
        }
        //mediaAdapter 提供了播放其他文件格式的支持
        else if (audioType.equalsIgnoreCase("vlc") || audioType.equalsIgnoreCase("mp4")) {
            mediaAdapter = new MediaAdapter(audioType);
            mediaAdapter.play(audioType, fileName);
        } else {
            System.out.println("Invalid media. " + audioType + " format not supported");
        }
    }

    public static void main(String[] args) {
        String str = "{\n" + "    \"has_more\": false,\n" + "    \"user_list\": [\n" + "        {\n" + "            \"staff_id\": \"fb9627ec1127415cbcb1bbf0968f26be\",\n" + "            \"departments\": [\n" + "                {\n" + "                    \"id\": \"1\",\n" + "                    \"name\": \"深圳吉祥服务\"\n" + "                }\n" + "            ]\n" + "        },\n" + "        {\n" + "            \"staff_id\": \"13058109921\",\n" + "            \"departments\": [\n" + "                {\n" + "                    \"id\": \"1\",\n" + "                    \"name\": \"深圳吉祥服务\"\n" + "                }\n" + "            ]\n" + "        },\n" + "        {\n" + "            \"staff_id\": \"LX001\",\n" + "            \"departments\": [\n" + "                {\n" + "                    \"id\": \"1\",\n" + "                    \"name\": \"深圳吉祥服务\"\n" + "                }\n" + "            ]\n" + "        }\n" + "    ],\n" + "    \"msg\": \"success\",\n" + "    \"code\": 0\n" + "}";

        LxSelectBean lxSelectBean = JSON.parseObject(str, LxSelectBean.class);
        
        System.out.println(lxSelectBean);
    }
}